import { computed, ref } from "vue";

export const LoginStateEnum = {
  LOGIN: 0,
  REGISTER: 1,
  RESET_PASSWORD: 2,
  MOBILE: 3,
  QR_CODE: 4,
};

const currentState = ref(LoginStateEnum.LOGIN);

export const useLoginState = () => {
  const getLoginState = computed(() => currentState.value);

  const setLoginState = (state) => {
    currentState.value = state;
  };
  const backLogin = () => {
    currentState.value = LoginStateEnum.LOGIN;
  };

  return { getLoginState, setLoginState, backLogin };
};
